-- active_drawing
-- create by huanghr
-- 激活图纸

return {
    apply = function(source, target, classId, value)
        -- 记录到迷宫字段上,记录激活的图纸对应道具
        local activedDrawing = DungeonM.getDungeonMixedField("actived_drawing");

        -- 没有记录
        local classValue = tostring(value);
        if activedDrawing == nil then
            activedDrawing = classValue;
        else
            local arr = string.explode(activedDrawing, "|");

            if table.indexOf(arr, classValue) == -1 then
                activedDrawing = activedDrawing .. "|" .. classValue;
            else
                return;
            end
        end

        -- 记录到激活的图纸
        DungeonM.setDungeonMixedField("actived_drawing", activedDrawing);

        -- 抛出激活对应图纸事件（直接使用doAlert会与上一条重复）
        EventMgr.fire(event.ACTIVE_DRAWING, {["classId"] = value, ["delay"] = 2});
    end,
};
